UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0drcJ23y0IDdQVVfzAjvMEum+hn/srm2daetwrKfm2o=' 
WHERE 
  key_id = '2e05bfb313bb702deb266798b2a99704a8b533012874fb0ce71798ee87aaefe1' 
  AND (
    token = '0drcJ23y0IDdQVVfzAjvMEum+hn/srm2daetwrKfm2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046