UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hTyoWtOtWmCHsvshR3gFv7BlAQDx5hRGvZ4Hawy+k7M=' 
WHERE 
  key_id = '84de5581c5f2465732f9d5cbd14e3f44a541e4ea019e8a4d83484dacc5a16938' 
  AND (
    token = 'hTyoWtOtWmCHsvshR3gFv7BlAQDx5hRGvZ4Hawy+k7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029