UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'quKGfbH4DW/U0jRThZCqBBQEazJw80q4Bug5vJ7+l2Q=' 
WHERE 
  key_id = '371f608c553f05080348f0261bb2b44da6ca4783405eabb36c548661cf426366' 
  AND (
    token = 'quKGfbH4DW/U0jRThZCqBBQEazJw80q4Bug5vJ7+l2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053