UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A5CU9S7e9GN0eJ3yaVcV2T2vAlE3yqS8024gmsLtaNw=' 
WHERE 
  key_id = 'ffcbeab5bacbf585508094cc173456c517532348ca336c0fe3c419c64d1f7ece' 
  AND (
    token = 'A5CU9S7e9GN0eJ3yaVcV2T2vAlE3yqS8024gmsLtaNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082