UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8gzD4Wt8A8qBvZM9EsmAVat7Oo9ok1MRY1YqOz9PoU8=' 
WHERE 
  key_id = 'ce7464d804cf4b4435ee96eb17dde3f69fe9504e0a36074035f4dfbb1a277a6b' 
  AND (
    token = '8gzD4Wt8A8qBvZM9EsmAVat7Oo9ok1MRY1YqOz9PoU8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033