UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H4/tPMX+kc5LWrQkOR+a8eylOTYELFWCt+ebrVTxZwU=' 
WHERE 
  key_id = '8d2d727ccbc2cb0b7a89ad246188772c8bf21343397698b8d03bda56fe830a7d' 
  AND (
    token = 'H4/tPMX+kc5LWrQkOR+a8eylOTYELFWCt+ebrVTxZwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029