UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+h4+hBcv3WJ13DxE72E/XLIrJmzcPT+J8ksXXpPX4w=' 
WHERE 
  key_id = '10244e70da11f75891acf80388caaa30bbed44bf07ef7fa789e5b5d097991540' 
  AND (
    token = 'C+h4+hBcv3WJ13DxE72E/XLIrJmzcPT+J8ksXXpPX4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027