UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qps7MMQQbXQrPNncQiEi/SzesT72GgF+xzVgPfQFrZc=' 
WHERE 
  key_id = '1392c7dc464288b3b0a5d4096c47f117f03e0547dfbf043ec9331871aebf9e00' 
  AND (
    token = 'qps7MMQQbXQrPNncQiEi/SzesT72GgF+xzVgPfQFrZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033