UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g/Hy+0Hg0ndx35QflHJh0BUwLFfia1OV6YZwkcKzA2U=' 
WHERE 
  key_id = '78254ec2a1f900b22e8ae190e738c2b1e5d571831b9c81dbb397829236d25d8e' 
  AND (
    token = 'g/Hy+0Hg0ndx35QflHJh0BUwLFfia1OV6YZwkcKzA2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037