UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LXiXchWI/IwbFQOBZPjsTFBigZry2IGw7M/r+QI1NrQ=' 
WHERE 
  key_id = 'd59b2f65f31f56501774206a7eb0429ea7e2fafcdaafa7cd92e8a77489a95993' 
  AND (
    token = 'LXiXchWI/IwbFQOBZPjsTFBigZry2IGw7M/r+QI1NrQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042