UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xePFVTfSvY6NOn3ide91CNo2ptqeL8+aDv01yWktiUw=' 
WHERE 
  key_id = '5d0fa88a9451f7a7c4a9b03210203599976710443ed7192cb4a5839c994191e7' 
  AND (
    token = 'xePFVTfSvY6NOn3ide91CNo2ptqeL8+aDv01yWktiUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021