UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CyvCXQ8snXd9vlTrTOWd6cvN4ro499ZPsHLWN65gSys=' 
WHERE 
  key_id = '9f18932c7b8a34ff576b77e44e9125b0bbf7c3e9a92e5927c96a82d3e4551248' 
  AND (
    token = 'CyvCXQ8snXd9vlTrTOWd6cvN4ro499ZPsHLWN65gSys=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040