UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B7uRc2/dfI/1+STAmowT58h718t5EMCQ7pqVYsLKGWE=' 
WHERE 
  key_id = '7ed0ccb963364cba1558c59e9ebf0ecf191229183e27a3b7454e0dddebd98620' 
  AND (
    token = 'B7uRc2/dfI/1+STAmowT58h718t5EMCQ7pqVYsLKGWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031