UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tU77A1MplkSZf0lPEX6pgAkmWUeiV/aY5VOQ6zg+n+A=' 
WHERE 
  key_id = '0e999bfa1f76436925cf909f610f420c3896d8d8bc8b55870644efafb02c0be1' 
  AND (
    token = 'tU77A1MplkSZf0lPEX6pgAkmWUeiV/aY5VOQ6zg+n+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025