UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gHuBTysKFdyIuytMmmdi8QCPLTVhOrx+qyrsUfcPqvo=' 
WHERE 
  key_id = 'ff0cde9043975dfba3495e4c364386038e1a0d196ff3871a52090c9baec4ed86' 
  AND (
    token = 'gHuBTysKFdyIuytMmmdi8QCPLTVhOrx+qyrsUfcPqvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020