UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ns0ooZ8pNKFyGSXX3AKm+yeMML3CJRz5LK9ISQhJ5os=' 
WHERE 
  key_id = 'bdc4b79c67f85683748d844ad7669135bf65951d97591ea09b142cca556908d3' 
  AND (
    token = 'ns0ooZ8pNKFyGSXX3AKm+yeMML3CJRz5LK9ISQhJ5os=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023