UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uQmfKyuQTXB9ffJjUbRWgdFZQ5VllL6AlG4quUtNpII=' 
WHERE 
  key_id = 'f3f5170bebf6eddc3f064303e404dd41e714f244d98d644ba682b0ad38b415ed' 
  AND (
    token = 'uQmfKyuQTXB9ffJjUbRWgdFZQ5VllL6AlG4quUtNpII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042