UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dVa84/C7QJEucSOpYVeb8+6k3SSqXj9xFvovbwD9D44=' 
WHERE 
  key_id = '18eb49eaad06b0bfe36909801b71b334955399549cb9a5601cb60a597f3eabef' 
  AND (
    token = 'dVa84/C7QJEucSOpYVeb8+6k3SSqXj9xFvovbwD9D44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034