UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xMpMqIV36TGoZHBrGattalLxQ/a94e1ZU/moMrlyAOc=' 
WHERE 
  key_id = '4b5cd14d2e4c7ceadebded034521c376444bf9fe3892530fc09cc605770d32f3' 
  AND (
    token = 'xMpMqIV36TGoZHBrGattalLxQ/a94e1ZU/moMrlyAOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033