UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HHf/mcgETD9PcNUIix9mEPJrJAd55XdINrx+zZhX1OA=' 
WHERE 
  key_id = '74fd0a1267cdf3c0ea3a398425fddf699dc167305de2b8a9a1beb80021ac8e22' 
  AND (
    token = 'HHf/mcgETD9PcNUIix9mEPJrJAd55XdINrx+zZhX1OA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045