UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zNLoGyF7+Ya+zMSBpTTttVmEOpdQraKo4n00BDA+TE4=' 
WHERE 
  key_id = '0e277871b36241e1fbf43fb47304d1bb795feba23183bc4b10652389bd142c51' 
  AND (
    token = 'zNLoGyF7+Ya+zMSBpTTttVmEOpdQraKo4n00BDA+TE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034