UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1WN9ivM3lUYdcMdB+qKEmnn9j/yO/huMX3b/MEdhp1I=' 
WHERE 
  key_id = 'cdea3946a38fef71f2042f5faf63380f1ea88dc942500d14c91eb38cb8046b76' 
  AND (
    token = '1WN9ivM3lUYdcMdB+qKEmnn9j/yO/huMX3b/MEdhp1I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016