UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RqpWlEFMPdBOaTQN+iRmZ10653LN2ZB2QoKu8+QeEqw=' 
WHERE 
  key_id = '076c60ef5803bd285a271384f4a510b02af3674145dc0b66424d9f0b365c20d2' 
  AND (
    token = 'RqpWlEFMPdBOaTQN+iRmZ10653LN2ZB2QoKu8+QeEqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025