UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YD2UsBuoqaqQt0+GRZFRb3SGqBbNQMyG6Wi8X+cSdhM=' 
WHERE 
  key_id = '344b682ca26b3bbe46b45b97c0a14cb2b532285ac2dbd88dfcddf4620118e2b6' 
  AND (
    token = 'YD2UsBuoqaqQt0+GRZFRb3SGqBbNQMyG6Wi8X+cSdhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028