UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm666FvryHyGw9FDEa02z6gr/U77mlwuJMsCFKxIVJVQ=' 
WHERE 
  key_id = 'a4c57abb12638fa528551619f50d9eebbeec41031650377a60d32591c26606bc' 
  AND (
    token = 'm666FvryHyGw9FDEa02z6gr/U77mlwuJMsCFKxIVJVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031