UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tpV0MXFzFNPPyjqhEqzazwDF+o1ph5UrBb39blyw5kk=' 
WHERE 
  key_id = '44f775de7bb40d2b76443a992862923bd973bfd122ae1a8566080fd7b31c9af9' 
  AND (
    token = 'tpV0MXFzFNPPyjqhEqzazwDF+o1ph5UrBb39blyw5kk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046