UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '48QSPnY6rhU6aWGyJxXYR+2wNQudaHUgmCQemm/vSTI=' 
WHERE 
  key_id = 'af414df327a5ee0051cdea9057ff502d8f910e0f02602de3ebf7428071b73653' 
  AND (
    token = '48QSPnY6rhU6aWGyJxXYR+2wNQudaHUgmCQemm/vSTI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039