UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bEAukB3Y2QgHWU+d8d9n7ECFNXaz8ceun5juIp420Ls=' 
WHERE 
  key_id = '907c87ee73bf56b5699579a4d98588f3efb956c13bd10e9f7fbd76a81cf8b2e4' 
  AND (
    token = 'bEAukB3Y2QgHWU+d8d9n7ECFNXaz8ceun5juIp420Ls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045