UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rO2AfwSy8L+3RLVQLEF5yRMKZgBlKTe6UrEnbkR4Yx4=' 
WHERE 
  key_id = '64f20eccf38e81cfa2ff9864a804d6f5a54a3a65c144ea782dfab30d4b6aaa15' 
  AND (
    token = 'rO2AfwSy8L+3RLVQLEF5yRMKZgBlKTe6UrEnbkR4Yx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046