UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GW48MXvVpc1JjhgbaSN5eXUGN2LgR3lDd+q6/E/tVEU=' 
WHERE 
  key_id = '557c8d6fbf8bc237b251c7cc1b3eb76485f79b394fb6f8071d3924b605701b8b' 
  AND (
    token = 'GW48MXvVpc1JjhgbaSN5eXUGN2LgR3lDd+q6/E/tVEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023