UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tk7m3MKN1pQqd4eTQWLN1OAsQQ+4GFHbl7uVAaAIyy0=' 
WHERE 
  key_id = 'cfd0f8f0c307b75885fdff26b011e6a5d9ad0afba92c50ecad5c8e6874a9940b' 
  AND (
    token = 'Tk7m3MKN1pQqd4eTQWLN1OAsQQ+4GFHbl7uVAaAIyy0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033