UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k+6IhBmVgYFrmyb50NFW5oZbK+TKFFGwN9oqNwwyk9c=' 
WHERE 
  key_id = '6d87f5774c116c502650ad038d5d2f5625450be60269be205524fb2db939d1df' 
  AND (
    token = 'k+6IhBmVgYFrmyb50NFW5oZbK+TKFFGwN9oqNwwyk9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016