UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y6hyk/R6sQbrgbK/T3GGAn22ISrCOBqJBXB2KBHfE4k=' 
WHERE 
  key_id = '47100c7f546bbc92be4065d5f9fdf0bfda3663b5d4f353e9087f7754a39241b4' 
  AND (
    token = 'y6hyk/R6sQbrgbK/T3GGAn22ISrCOBqJBXB2KBHfE4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054